package com.share.spock.rest;

import com.share.spock.model.UserInfo;
import com.share.spock.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author caifan
 * @since 2021/9/29
 * description:
 */
@RestController
@RequestMapping("/userInfo")
public class UserInfoRest {

    @Autowired
    private UserInfoService userInfoService;

    @PostMapping("/save")
    public String saveUserInfo(@RequestBody UserInfo userInfo) {
        userInfoService.insertUserInfo(userInfo);
        return "success";
    }

    @PostMapping("/update")
    public String updateUserInfo(@RequestParam Long id, @RequestParam String username, @RequestParam String nickname) {
        userInfoService.updateUserInfo(id, username, nickname);
        return "success";
    }
}
